package com.yan.demo.loopdemo;

public class ForDemo5 {
    public static void main(String[] args) {
        int i, bit1, bit2, bit3;
        int sum = 0;
        for (i = 100; i < 1000; i++) {
            bit1 = i / 1 % 10;
            bit2 = i / 10 % 10;
            bit3 = i / 100 % 10;
            if (Math.pow(bit1, 3) + Math.pow(bit2, 3) + Math.pow(bit3, 3) == i) {
                sum += i;
                System.out.println(i);
            }
        }
        System.out.println(sum);
    }
}
